package com.feisi.test;//package com.feisi.test;
//
//import com.feisi.dao.UserDao;
//import com.feisi.domain.User;
//import org.apache.ibatis.io.Resources;
//import org.apache.ibatis.session.SqlSession;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.apache.ibatis.session.SqlSessionFactoryBuilder;
//import org.junit.Test;
//
//import java.io.IOException;
//import java.io.InputStream;
//import java.util.Date;
//import java.util.List;
//
//public class testMybatis {
//
//    @Test
//    public void testFindAll() throws IOException {
//
//        InputStream in = Resources.getResourceAsStream("SqlMapConfig.xml");
//
//        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(in);
//
//        SqlSession sqlSession = sessionFactory.openSession();
//
//        UserDao dao = sqlSession.getMapper(UserDao.class);
//
//        List<User> users = dao.findAll();
//
//        for (User user : users) {
//            System.out.println(user);
//        }
//        System.out.println(users.size());
//
//        sqlSession.close();
//        in.close();
//
//    }
//
//
//    @Test
//    public void testSaveUser() throws IOException {
//
//        InputStream in = Resources.getResourceAsStream("SqlMapConfig.xml");
//
//        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(in);
//
//        SqlSession sqlSession = sessionFactory.openSession();
//
//        UserDao dao = sqlSession.getMapper(UserDao.class);
//
//        User user = new User(null,"Lev","123","15115086056","身份证","430681199910102957","男",
//                21,new Date(),"否","中国","汉族","共青团员","湖南岳阳","健康","本科",1001,"销售部",new Date(),
//                "销售","经理");
//
//        dao.saveUser(user);
//
//        sqlSession.commit();
//        sqlSession.close();
//        in.close();
//
//    }
//
//
//}
